﻿using Autofac;
using SDataGen.Views;
using Sdg.Domain;
using Sdg.Domain.Repositories;
using Sdg.Domain.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace SDataGen
{
    internal class ViewManager : IViewManager
    {
        private IContainer _container;
        private IMainWindow _mainWindow;

        

        public ViewManager(IContainer diContainer,IMainWindow mainWindow)
        {
            _container = diContainer;
            _mainWindow = mainWindow;
        }

        public void InitializeViews(Director director)
        {
            AddView(director, new ConnectionView());

            AddView(director, new TablesView(_container.Resolve<ITableRepository>()));
        }

        private void AddView(Director director, IView view)
        {
            _mainWindow.AddView(view);
            director.AddView(view);
        }

        

        public IMainWindow MainWindow
        {
            get { return _mainWindow; }
        }
    }
}
